package com.neusoft.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.neusoft.po.User;

@Mapper
public interface UserMapper {
    @Select("select * from user where userId=#{userId} and password=#{password}")
    public User getUserByIdByPass(User user);

    @Select("select count(*) from user where userId=#{userId}")
    public int getUserById(String userId);

    @Select("SELECT * FROM user WHERE userId=#{userId}")
    User getById(String userId);

    @Insert("insert into user values(#{userId},#{password},#{userName},#{userSex},null,1)")
    public int saveUser(User user);

    @Update("UPDATE user SET userId=#{userId}, password=#{password}, userName=#{userName}, userSex=#{userSex}, userImg=#{userImg}, delTag=#{delTag} WHERE userId=#{userId}")
    int updateUser(
            @Param("userId") String userId,
            @Param("password") String password,
            @Param("userName") String userName,
            @Param("userSex") Integer userSex,
            @Param("userImg") String userImg,
            @Param("delTag") Integer delTag
    );
}
